home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / ZIRESULT.CPP < prev    next >
C/C++ Source or Header  |  1993-08-09  |  5KB  |  156 lines

  1. //----------------------------------------------------------------------------
  2. //                            MODULE DESCRIPTION
  3. //
  4. //  Module:    ziresult.cpp
  5. //   Title:    ZIP+4 Engine
  6. //  Notice:    John M. Weeder
  7. //                 Copyright (c) 1993. All rights reserved.
  8. //             This module contains proprietary information and should be 
  9. //                treated as confidential.
  10. //
  11. //----------------------------------------------------------------------------
  12. //                           MAINTENANCE HISTORY
  13. //
  14. // $Workfile$
  15. // $Revision$
  16. //   $Author$
  17. //     $Date$
  18. //      $Log$    
  19. //
  20. //----------------------------------------------------------------------------
  21. //                             MODULE NARRATIVE
  22. //
  23. //    This module contains code for the class ZI_RESULT.
  24. //
  25. //    The code in this module may be written in C++ or C.
  26. //
  27. //    This module is portable to:
  28. //        DOS 3.X+
  29. //        MS Windows 3.X+
  30. //        OS/2 2.X+
  31. //        OS/2 2.0 PM
  32. //
  33. //    The following compilers are supported:
  34. //        MSC 6.0A
  35. //        MSC/C++ 7.0
  36. //        Borland C++ 3.1 for DOS
  37. //        Borland C++ 1.0 for OS/2 2.X
  38. //
  39. //----------------------------------------------------------------------------
  40. #include <zi.hpp>
  41. #define USE_WIN_RESULT
  42. #if OS_DOS
  43. #include <zid.hpp>
  44. #elif OS_WINDOWS
  45. #include <ziw.hpp>
  46. #else
  47. #include <zio.hpp>
  48. #endif
  49.  
  50.  
  51. //----------------------------------------------------------------------------
  52. //   Description:    Default constructor
  53. //    Parameters:
  54. //       Returns:    
  55. //----------------------------------------------------------------------------
  56. FN_M ZI_RESULT::ZI_RESULT(PCSZ _pcszResults)
  57. : ZN_WINDOW("WIN_RESULT", ZN_LOAD_CENTER|ZN_LOAD_NO_SHOW)
  58. {
  59.     ZI_RESULT::Initialize(CL_INIT_CLASS);
  60.     pcszResults = _pcszResults ? _pcszResults: "";
  61.     Setup();
  62. }
  63.  
  64.  
  65. //----------------------------------------------------------------------------
  66. //   Description:    Destructor
  67. //    Parameters:
  68. //       Returns:    
  69. //----------------------------------------------------------------------------
  70. FN_M ZI_RESULT::~ZI_RESULT()
  71. {
  72.     ZI_RESULT::Destroy(FALSE);
  73.     Terminate();
  74. }
  75.  
  76.  
  77. //----------------------------------------------------------------------------
  78. //   Description:    Destroy object. Free any resources used by object.
  79. //                          Normally called by destructor.
  80. //                        Should allow multiple calls from various classes.
  81. //                        A class should almost always re-init its variables when 
  82. //                        it is destroyed to prevent accidents.
  83. //    Parameters:    fDestroyAll        Destroy parents also?
  84. //                                            Default is TRUE.
  85. //       Returns:    TRUE if successful.
  86. //----------------------------------------------------------------------------
  87. BOOL FN_M ZI_RESULT::Destroy(BOOL fDestroyAll)
  88. {
  89.     ZI_RESULT::Initialize(CL_INIT_CLASS_VARS);
  90.     if (fDestroyAll)                            // Destroy parent.
  91.         ZI_RESULT_PARENT::Destroy(fDestroyAll);
  92.     return TRUE;
  93. }
  94.  
  95.  
  96. //----------------------------------------------------------------------------
  97. //   Description:    Initialize object. 
  98. //                          Normally called by constructor.
  99. //                        Should allow multiple calls from various classes.
  100. //    Parameters:    sInit        Initialization code. May be one of the following:
  101. //                                        CL_INIT_CLASS            Reset class variables and
  102. //                                                                    and dynamic allocations for
  103. //                                                                    this class only.
  104. //                                        CL_INIT_CLASS_VARS    Reset class variables for
  105. //                                                                    this class only.
  106. //                                        CL_INIT_VARS            Reset class variables for
  107. //                                                                    this class only.
  108. //                                        CL_INIT_ALL                Initialize class and all 
  109. //                                                                    parent class, including
  110. //                                                                    dynamic memory allocation.
  111. //                                    Default is CL_INIT_ALL
  112. //       Returns:    TRUE if successful.
  113. //----------------------------------------------------------------------------
  114. BOOL FN_M ZI_RESULT::Initialize(SHORT sInit)
  115. {
  116.     if (sInit == CL_INIT_VARS || sInit == CL_INIT_ALL)
  117.         ZI_RESULT_PARENT::Initialize(sInit);
  118.  
  119.     return TRUE;
  120. }
  121.  
  122.  
  123. //----------------------------------------------------------------------------
  124. //   Description:    Event monitor function.
  125. //    Parameters:    msg        Event code
  126. //                        pv1            Data pointer 1
  127. //                        pv2            Data pointer 2
  128. //       Returns:    Event code
  129. //----------------------------------------------------------------------------
  130. ZN_MSG FN_M ZI_RESULT::User(ZN_MSG msg, PVOID, PVOID)
  131. {
  132.     switch (msg)
  133.         {
  134.         case ZN_MSG_INIT:
  135.             SetText(FID(TEXT_RESULTS), pcszResults, strlen(pcszResults)+1);
  136.             return msg;
  137.  
  138.         case ZN_MSG_TERMINATE:
  139.             return msg;
  140.         }
  141.     if (IsError())                                // Error condition
  142.         return msg;
  143.     switch (msg)
  144.         {
  145.         case BUTTON_OK:
  146.             Close();
  147.             break;
  148.         }
  149.     return msg;
  150. }
  151. //----------------------------------------------------------------------------
  152. //------------------------------- End of File --------------------------------
  153. //----------------------------------------------------------------------------
  154.  
  155.  
  156.